"""gma URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URL conf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""

from django.conf.urls import url
from django.views.decorators.csrf import csrf_exempt

from apps.mp import views

from utils import wx_util
from utils.wx_util import WxWebAuthCallbackView

urlpatterns = [
    # ------------------------------------------------------------------------------
    # 微信登录
    # ------------------------------------------------------------------------------

    # 微信网页授权入口地址
    url(r'^wx_auth/$', wx_util.wx_web_auth_view, name='wx_web_auth'),
    # 微信网页授权回调通知地址
    url(r'^wx_auth_callback/', csrf_exempt(WxWebAuthCallbackView.as_view()), name='web_auth_callback'),
    # url(r'^wx_auth_callback/', wx_util.wx_web_auth_callback_first_view, name='web_first_auth_callback'),

    # ------------------------------------------------------------------------------
    # 充值/提现
    # ------------------------------------------------------------------------------

    # 微信公众号: 充值
    # url(r'^pay/$', views.pay, name='pay'),
    url(r'^pay/$', views.pay_v2, name='pay'),
    # url(r'^pay/$', views.pay_with_hsq, name='pay'),
    # 微信公众号: 慧收钱MP充值
    url(r'^pay_with_hsq/$', views.pay_with_hsq, name='pay_with_hsq'),

    # 微信公众号: 支付宝充值
    url(r'^pay_with_ali/$', views.pay_with_ali, name='pay_with_ali'),
    # 微信公众号: 获取预支付信息
    url(r'^api/get_prepay_info/$', views.api_get_prepay_info, name='api_get_prepay_info'),
    # 微信公众号: 提现
    url(r'^withdraw/$', views.withdraw, name='withdraw'),

    # 微信公众号: 查询用户信息
    url(r'^api/user_info/$', views.api_user_info, name='api_user_info'),
    # 微信公众号: 获取慧收钱App充值的预支付信息
    # url(r'^api/get_hsq_mp_prepay_info/$', views.api_get_hsq_mp_prepay_info, name='api_get_hsq_mp_prepay_info'),

    # ------------------------------------------------------------------------------
    # 其它
    # ------------------------------------------------------------------------------

    # 微信公众号: 关于
    url(r'^about/$', views.about, name='about'),
    # 下载APP
    url(r'^download/(?P<app>\w+)/$', views.download_app, name='download_app'),
    # 下载APP
    url(r'^app/(?P<app>\w+)/(?P<channel>\w+)/$', views.download_app_by_channel, name='download_app_by_channel'),

    # 微信公众号: 服务条款
    url(r'^agreement/(?P<app>\w+)/$', views.agreement, name='agreement'),
    # 微信公众号: 隐私条款
    url(r'^privacy/(?P<app>\w+)/$', views.privacy, name='privacy'),
    # 微信公众号: url scheme
    url(r'^url/schemes/(?P<app_code>.+)/(?P<path>.+)/$', views.url_schemes, name='url_schemes'),
]
